package com.cus.tom.transfer.ac

import android.annotation.SuppressLint
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.ProgressBar
import android.widget.TextView
import com.cus.tom.transfer.R
import com.snap.base.base.BaseAdSplashAct
import com.snap.base.ktx.isConfigGoBuy
import com.snap.base.util.BaseUtil
import com.snap.util.setStatusBarLight
import com.snap.util.startAct

class SplashAct : BaseAdSplashAct() {

    private var progressBar: ProgressBar? = null
    private var progressTV: TextView? = null
    private var bar: View? = null;

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        progressBar = findViewById(R.id.pb)
        progressTV = findViewById(R.id.tv_pb)
        bar = findViewById(R.id.givSplash)
        this.setStatusBarLight(true)
    }

    @SuppressLint("SetTextI18n")
    override fun updateProgress(progress: Int) {
        progressBar?.progress = progress
        bar?.visibility = View.VISIBLE
        progressTV?.visibility = View.VISIBLE
        progressTV?.text = "请稍后~资源正在加载中$progress%"
    }

    @SuppressLint("WrongViewCast")
    override fun getAdSplash(): ViewGroup {
        return findViewById(R.id.fl)
    }

    override fun getLayoutId(): Int {
        return R.layout.act_splash
    }

    override fun startMainAct() {
        startAct(MainActivity::class.java)
        finish()
    }
}